package com.shanzmoo.db.module.member.domain.vo;

import com.alibaba.fastjson.JSON;
import com.shanzmoo.db.module.member.entity.MemberAddressEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;

@Data
@ApiModel("用户地址保存对象")
public class MemberAddressVo implements Serializable {

    private static final long serialVersionUID = 1758L;

    @ApiModelProperty(value = "地址id", example = "1")
    private Integer id;

    @ApiModelProperty(value = "联系人", example = "刘浩")
    private String contacts;

    @ApiModelProperty(value = "联系电话", example = "昊天")
    private String mobile;

    @ApiModelProperty(value = "收货地址Code（第三级：区编码）", example = "420100")
    private Integer districtCode;

    @ApiModelProperty(value = "省市区", example = "湖北省 武汉市 武昌区")
    private String districtStr;;

    @ApiModelProperty(value = "详细地址", example = "武汉天地")
    private String address;

    @ApiModelProperty(value = "是否默认地址", example = "false")
    private Boolean defaultAddress;

    public static MemberAddressVo create(MemberAddressEntity entity) {
        return JSON.parseObject(JSON.toJSONString(entity), MemberAddressVo.class);
    }
}
